Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix_add_special_feature_tests #778 #783

Open
wants to merge 6 commits into
base: master
Choose a base branch
from

Conversation

amjadnattouf
Copy link

The test_incompatible_audio_file_error test failed and raised the ValueError as mp3 format.
The test_sphinx_keywords fixed the tests before as they failed
Issue #778

Copy link
Collaborator

@ftnext ftnext left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you for splitting the pull request.
First I have a question.

tests/test_special_features.py Outdated Show resolved Hide resolved
tests/test_special_features.py Outdated Show resolved Hide resolved
Copy link
Collaborator

@ftnext ftnext left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for moving the test code.

Please remove all comments.
Your change can "Explain Yourself in Code (ref: Clean Code)", so it seems that there is no need for comments

@amjadnattouf amjadnattouf requested a review from ftnext November 16, 2024 22:42
@amjadnattouf
Copy link
Author

@ftnext done ✅

Copy link
Collaborator

@ftnext ftnext left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you for the fix so far.

I have added comments on more specifics as the code has become more concise.

@@ -141,6 +141,16 @@ def test_flac_stereo_24_bit(self):
else:
self.assertSimilar(audio.get_raw_data()[:32], b"\x00\x00\x00\x00\x00\x00\xfe\xff\x00\x00\x02\x00\x00\x00\xfe\xff\x00\x00\x00\x00\x00\xff\x01\x00\x00\x02\xfc\xff\x00\xfe\x01\x00")

def test_incompatible_audio_file_error(self):
self.AUDIO_FILE_EN_MP3 = path.join(path.dirname(path.realpath(__file__)), "english.mp3")
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

self.AUDIO_FILE_EN_MP3 -> AUDIO_FILE_EN_MP3
self seems to be unnecessary.

self.AUDIO_FILE_EN_MP3 = path.join(path.dirname(path.realpath(__file__)), "english.mp3")
r = sr.Recognizer()
with self.assertRaises(ValueError) as context:
with sr.AudioFile(self.AUDIO_FILE_EN_MP3) as source:r.record(source)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

with sr.AudioFile(AUDIO_FILE_EN_MP3) as source:
    pass

Test target is AudioFile.__enter__(), so Recognizer is not required.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants